<%@ page language="java" import="java.util.*, java.text.*,java.sql.Timestamp,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.file.manager.*, com.zjut.zs.file.dao.*,
com.zjut.zs.file.manager.*, com.zjut.zs.file.dao.*,com.zjut.zs.zxlb.manager.*, com.zjut.zs.zxlb.dao.*,com.zjut.zs.shhd.manager.*, com.zjut.zs.shhd.dao.*,com.zjut.zs.hjqk.manager.*, com.zjut.zs.hjqk.dao.*,
com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>材料提交 - 招生报名系统</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/plugins/webupload/css/upload/upload.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/plugins/webupload/plugin/ueditor/third-party/webuploader/webuploader.css">
<script src="css/tailwindcss.css"></script>
<script type="text/javascript" src="../plugins/assets/plugins/jquery-3.5.1.min.js"></script>

<style type="text/css">
body { font-family: 'Noto Sans SC', sans-serif; background-color: #f8fafc; }
.select1 {
	border:1px solid #ccc;
	padding:8px;
	width:200px;
}
.input-focus {
    transition: all 0.3s ease;
}
.input-focus:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.card {
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
</style>
</head>

<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsFileManager fmanager = (ZsFileManager) SpringContextUtil.getBean("ZsFileManager");
ZsZxlbManager xmanager = (ZsZxlbManager) SpringContextUtil.getBean("ZsZxlbManager");
ZsShhdManager hmanager = (ZsShhdManager) SpringContextUtil.getBean("ZsShhdManager");
ZsHjqkManager jmanager = (ZsHjqkManager) SpringContextUtil.getBean("ZsHjqkManager");
StringBuffer zxstring = new StringBuffer();
ZsFile file = new ZsFile();
ZsUser user = null;
List flist = new ArrayList();
if((session.getAttribute("admin")!=null||session.getAttribute("user")!=null) && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");
}
ZsUserStatus userStatus = smanager.getDataByUser(user);
String key = MD5.toMD5(user.getUsId().toString());

String msg = " ";
boolean editpermit = false;
if( (Status.SENDSTATUS_YES.getStatus().equals(userStatus.getSendStatus())
&& Status.CHECKSTATUS_NULL.getStatus().equals(userStatus.getCheckStatus())
&& Status.ON.getStatus().equals(school.getScFilesendActive())
&& !Status.APPSTATUS_YES.getStatus().equals(userStatus.getAppStatus()) )//已经提交、未确认、未审核且开放上传
|| session.getAttribute("admin")!=null //或者是系统管理员
|| (Status.APPSTATUS_NOTIME.getStatus().equals(userStatus.getAppStatus())&&Status.CHECKSTATUS_NULL.getStatus().equals(userStatus.getCheckStatus())  )) {//或者是管理员退回延迟提交只要未审核就可以改
	editpermit = true;
}

if (!Status.ON.getStatus().equals(school.getScFilesendActive())) {
	msg = "已经截止上传";
} else if (Status.APPSTATUS_YES.getStatus().equals(userStatus.getAppStatus())){
    msg = "材料已经确认";
} else if (!Status.CHECKSTATUS_NULL.getStatus().equals(userStatus.getCheckStatus())) {
	msg = "材料已经初审";
}
%>

    <div class="max-w-6xl mx-auto px-4 py-6">
        <!-- 页面标题和状态信息 -->
        <div class="text-center mb-6">
            <div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4">
                <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-2">
                    <div class="text-blue-800 text-sm">
                        <span class="font-medium">材料确认状态：</span><%=userStatus.getAppStatus() %>，
                        <span class="font-medium">材料上传状态：</span><%=userStatus.getFileStatus() %>
                        <%
                        out.print(msg);
                        //如果初审直接截止
                        if(Status.APPSTATUS_NULL.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NO.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NOTIME.getStatus().equals(userStatus.getAppStatus())) {//未确认或者退回
                            out.println("。如果所有材料已经上传完整，请点击右侧'确认材料完整'完成提交！<button id='button' onclick='send()' class='px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200 font-medium ml-4' style='display:none'>确认信息材料完整</button>");
                        } else if(!Status.CHECKSTATUS_NULL.getStatus().equals(userStatus.getCheckStatus()) ) {
                            out.println("。<button class='px-3 py-2 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed ml-4'>已经截止</button>");
                        } else if(!Status.ON.getStatus().equals(school.getScAppActive()) || !Status.ON.getStatus().equals(school.getScFilesendActive())) {//未启用
                            out.println("。<button class='px-3 py-2 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed ml-4'>已经截止</button>");
                        } else if(Status.APPSTATUS_YES.getStatus().equals(userStatus.getAppStatus())) {//本人已经确认
                            out.println("。<button class='px-3 py-2 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed ml-4'>本人已确认材料</button>");
                        }
                        if (session.getAttribute("admin")!=null||session.getAttribute("user")!=null) {%>
                        <div class="mt-2">
                            <a href='../admin/zsImgRotate.jsp?fiType=sbcl&usId=<%=user.getUsId() %>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
                                <svg class="w-4 h-4 inline mr-1" fill="currentColor" viewBox="0 0 20 20">
                                    <path fill-rule="evenodd" d="M4 4a2 2 0 00-2 2v4a2 2 0 002 2V6h10a2 2 0 00-2-2H4zm2 6a2 2 0 012-2h8a2 2 0 012 2v4a2 2 0 01-2 2H8a2 2 0 01-2-2v-4zm6 4a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd"/>
                                </svg>
                                批量浏览模式(切换、放大、翻转)
                            </a>
                        </div>
                        <%} %>
                    </div>
                </div>
            </div>
        </div>

        <div id="show"></div>
    </div>
    <div id="ossfile"></div>
	<pre id="console"></pre>

    <div class="max-w-6xl mx-auto px-4 pb-8">
        <!-- 必需材料 -->
        <div class="mb-8">
            <h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
                <svg class="w-5 h-5 text-red-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
                    <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
                </svg>
                必需材料
            </h2>

            <%
            List fnlist = anconfig.getConfigsInfoByClass("上传材料名称(必需)");
            List fnlist2 = anconfig.getConfigsInfoByClass("上传材料名称(可选)");
            String filelocalview = anconfig.getSingleConfigInfoByName("材料本地浏览");
            System.out.println(fnlist.size());
            for (int i=0; i<fnlist.size(); i++){
                AnConfig fn = (AnConfig)fnlist.get(i);
                String fname = fn.getCoValue();
                file.setZsUser(user);
                file.setFiName(fname);
                file.setFiType("sbcl");
                flist = fmanager.getDataByInstance(1,100,"fiId","asc",file).getObjects();
            %>
            <div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
                <div class="flex flex-col md:flex-row md:items-center md:justify-between mb-4">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <%=fn.getCoValue() %> <span class="text-red-500">*</span>
                    </h3>
                    <%if(editpermit){%>
                    <button id="a<%=i %>" onclick="upload('<%=fn.getCoValue() %>','sbcl')" class="flex items-center px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200">
                        <svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
                            <path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
                        </svg>
                        上传材料
                    </button>
                    <%} %>
                </div>

                <div class="overflow-x-auto">
                    <table class="min-w-full bg-white border border-gray-200 rounded-lg">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-gray-200">
                            <%
                            if (flist.size()>0) {
                                for (int k = 0; k < flist.size(); k++) {
                                    ZsFile fi = (ZsFile)flist.get(k);
                                    String fileName = fname+"材料"+(k+1);
                                    String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
                            %>
                            <tr class="hover:bg-gray-50 transition-colors">
                                <td class="px-4 py-3 text-sm text-gray-900">
                                    <a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
                                        <%=fileName%> <%=fi.getAddTime()%>
                                    </a>
                                </td>
                                <td class="px-4 py-3">
                                    <a href='<%=url%>' target='_blank' class="inline-block">
                                        <img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
                                    </a>
                                </td>
                                <td class="px-4 py-3 text-sm">
                                    <%if(editpermit){%>
                                    <button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
                                        删除
                                    </button>
                                    <%} %>
                                </td>
                            </tr>
                            <%} } else { %>
                            <tr>
                                <td colspan="3" class="px-4 py-3 text-sm text-red-600 text-center">尚未上传</td>
                            </tr>
                            <%} %>
                        </tbody>
                    </table>
                </div>
            </div>
            <%} %>

            <!-- 可选材料 -->
            <div class="mb-8">
                <h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
                    <svg class="w-5 h-5 text-green-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                    </svg>
                    可选材料
                </h2>

                <%
                for (int i=0; i<fnlist2.size(); i++){
                    AnConfig fn = (AnConfig)fnlist2.get(i);
                    String fname = fn.getCoValue();
                    file.setZsUser(user);
                    file.setFiName(fname);
                    file.setFiType("sbcl");
                    flist = fmanager.getDataByInstance(1,100,"fiId","asc",file).getObjects();
                %>
                <div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
                    <div class="flex flex-col md:flex-row md:items-center md:justify-between mb-4">
                        <h3 class="text-lg font-semibold text-gray-900">
                            <%=fn.getCoValue() %>
                        </h3>
                        <%if(editpermit){%>
                        <button id="aa<%=i %>" onclick="upload('<%=fn.getCoValue() %>','sbcl')" class="flex items-center px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-colors duration-200">
                            <svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
                                <path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
                            </svg>
                            上传材料
                        </button>
                        <%} %>
                    </div>

                    <div class="overflow-x-auto">
                        <table class="min-w-full bg-white border border-gray-200 rounded-lg">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
                                    <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
                                    <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y divide-gray-200">
                                <%
                                if (flist.size()>0) {
                                    for (int k = 0; k < flist.size(); k++) {
                                        ZsFile fi = (ZsFile)flist.get(k);
                                        String fileName = fname+"材料"+(k+1);
                                        String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
                                %>
                                <tr class="hover:bg-gray-50 transition-colors">
                                    <td class="px-4 py-3 text-sm text-gray-900">
                                        <a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
                                            <%=fileName%> <%=fi.getAddTime()%>
                                        </a>
                                    </td>
                                    <td class="px-4 py-3">
                                        <a href='<%=url%>' target='_blank' class="inline-block">
                                            <img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
                                        </a>
                                    </td>
                                    <td class="px-4 py-3 text-sm">
                                        <%if(editpermit){%>
                                        <button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
                                            删除
                                        </button>
                                        <%} %>
                                    </td>
                                </tr>
                                <%} } else { %>
                                <tr>
                                    <td colspan="3" class="px-4 py-3 text-sm text-gray-500 text-center">尚未上传</td>
                                </tr>
                                <%} %>
                            </tbody>
                        </table>
                    </div>
                </div>
                <%} %>

                <!-- 其他材料 -->
                <%
                flist = fmanager.getOtherFiles(user.getUsId(),"sbcl");
                if (null!=flist && flist.size()>0) {
                %>
                <div class="mb-8">
                    <h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
                        <svg class="w-5 h-5 text-purple-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
                            <path fill-rule="evenodd" d="M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z" clip-rule="evenodd"/>
                        </svg>
                        其他材料
                    </h2>

                    <div class="card bg-white rounded-xl shadow-sm p-6">
                        <div class="overflow-x-auto">
                            <table class="min-w-full bg-white border border-gray-200 rounded-lg">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
                                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
                                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                                    </tr>
                                </thead>
                                <tbody class="divide-y divide-gray-200">
                                    <%
                                    for (int k = 0; k < flist.size(); k++) {
                                        ZsFile fi = (ZsFile)flist.get(k);
                                        String fileName = "其他材料"+(k+1);
                                        String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
                                    %>
                                    <tr class="hover:bg-gray-50 transition-colors">
                                        <td class="px-4 py-3 text-sm text-gray-900">
                                            <a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
                                                <%=fileName%> <%=fi.getAddTime()%>
                                            </a>
                                        </td>
                                        <td class="px-4 py-3">
                                            <a href='<%=url%>' target='_blank' class="inline-block">
                                                <img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
                                            </a>
                                        </td>
                                        <td class="px-4 py-3 text-sm">
                                            <%if(editpermit){%>
                                            <button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
                                                删除
                                            </button>
                                            <%} %>
                                        </td>
                                    </tr>
                                    <%} %>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <%} %>
            </div>
        </div>
    </div>






		<%
		if(Status.ON.getStatus().equals(school.getScZxlbActive())) {
		%>
		<!-- 专项类别材料 -->
		<div class="max-w-6xl mx-auto px-4 pb-8">
			<h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
				<svg class="w-5 h-5 text-orange-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
					<path fill-rule="evenodd" d="M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z" clip-rule="evenodd"/>
				</svg>
				专项类别佐证材料
			</h2>

			<%
			ZsZxlb zxlb = new ZsZxlb();
			List zlist = new ArrayList();
			if (user!=null) {
				zxlb.setZsUser(user);
				zlist = xmanager.getDataByInstance(1,100,"zxId","asc",zxlb).getObjects();
			}
			for (int i=0; i<zlist.size(); i++){
				ZsZxlb obj = (ZsZxlb)zlist.get(i);
				zxstring.append(obj.getZxType()+"|"+obj.getZxName()+"|"+obj.getZxJb()+";");
				String fname = obj.getZxName();
				file.setZsUser(user);
				file.setFiName(obj.getZxId()+"");
				file.setFiType("zxlb");
				flist = fmanager.findByExample(file);
			%>
			<div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
				<div class="flex flex-col md:flex-row md:items-center md:justify-between mb-4">
					<h3 class="text-lg font-semibold text-gray-900">
						<%=obj.getZxName() %> <span class="text-red-500">*</span>
					</h3>
					<%if(editpermit){%>
					<button id="a<%=i %>" onclick="upload('<%=obj.getZxId() %>','zxlb')" class="flex items-center px-3 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2 transition-colors duration-200">
						<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
							<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
						</svg>
						上传材料
					</button>
					<%} %>
				</div>

				<div class="overflow-x-auto">
					<table class="min-w-full bg-white border border-gray-200 rounded-lg">
						<thead class="bg-gray-50">
							<tr>
								<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
								<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
								<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
							</tr>
						</thead>
						<tbody class="divide-y divide-gray-200">
							<%
							if (flist.size()>0) {
								for (int k = 0; k < flist.size(); k++) {
									ZsFile fi = (ZsFile)flist.get(k);
									String fileName = fname+"材料"+(k+1);
									String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
							%>
							<tr class="hover:bg-gray-50 transition-colors">
								<td class="px-4 py-3 text-sm text-gray-900">
									<a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
										<%=fileName%> <%=fi.getAddTime()%>
									</a>
								</td>
								<td class="px-4 py-3">
									<a href='<%=url%>' target='_blank' class="inline-block">
										<img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
									</a>
								</td>
								<td class="px-4 py-3 text-sm">
									<%if(editpermit){%>
									<button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
										删除
									</button>
									<%} %>
								</td>
							</tr>
							<%} } else { %>
							<tr>
								<td colspan="3" class="px-4 py-3 text-sm text-red-600 text-center">尚未上传</td>
							</tr>
							<%} %>
						</tbody>
					</table>
				</div>
			</div>
			<%}} %>
		</div>






    		<%
			if(Status.ON.getStatus().equals(school.getScShhdActive())) {
			%>
			<!-- 社会活动材料 -->
			<div class="max-w-6xl mx-auto px-4 pb-8">
				<h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
					<svg class="w-5 h-5 text-indigo-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
						<path d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"/>
					</svg>
					社会活动佐证材料
				</h2>

				<%
				ZsShhd shhd = new ZsShhd();
				List hlist = new ArrayList();
				if (user!=null) {
					shhd.setZsUser(user);
					hlist = hmanager.getDataByInstance(1,100,"hdId","asc",shhd).getObjects();
				}
				for (int i=0; i<hlist.size(); i++){
					ZsShhd obj = (ZsShhd)hlist.get(i);
					String fname = obj.getHdName();
					file.setZsUser(user);
					file.setFiName(obj.getHdId()+"");
					file.setFiType("shhd");
					flist = fmanager.findByExample(file);
				%>
				<div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
					<div class="flex flex-col md:flex-row md:items-center md:justify-between mb-4">
						<h3 class="text-lg font-semibold text-gray-900">
							<%=obj.getHdName() %> <span class="text-red-500">*</span>
						</h3>
						<%if(editpermit){%>
						<button id="a<%=i %>" onclick="upload('<%=obj.getHdId() %>','shhd')" class="flex items-center px-3 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-colors duration-200">
							<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
								<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
							</svg>
							上传材料
						</button>
						<%} %>
					</div>

					<div class="overflow-x-auto">
						<table class="min-w-full bg-white border border-gray-200 rounded-lg">
							<thead class="bg-gray-50">
								<tr>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
								</tr>
							</thead>
							<tbody class="divide-y divide-gray-200">
								<%
								if (flist.size()>0) {
									for (int k = 0; k < flist.size(); k++) {
										ZsFile fi = (ZsFile)flist.get(k);
										String fileName = fname+"材料"+(k+1);
										String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
								%>
								<tr class="hover:bg-gray-50 transition-colors">
									<td class="px-4 py-3 text-sm text-gray-900">
										<a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
											<%=fileName%> <%=fi.getAddTime()%>
										</a>
									</td>
									<td class="px-4 py-3">
										<a href='<%=url%>' target='_blank' class="inline-block">
											<img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
										</a>
									</td>
									<td class="px-4 py-3 text-sm">
										<%if(editpermit){%>
										<button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
											删除
										</button>
										<%} %>
									</td>
								</tr>
								<%} } else { %>
								<tr>
									<td colspan="3" class="px-4 py-3 text-sm text-red-600 text-center">尚未上传</td>
								</tr>
								<%} %>
							</tbody>
						</table>
					</div>
				</div>
				<%}} %>
			</div>







    		<%
			if(Status.ON.getStatus().equals(school.getScHjqkActive())) {
			%>
			<!-- 获奖情况材料 -->
			<div class="max-w-6xl mx-auto px-4 pb-8">
				<h2 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
					<svg class="w-5 h-5 text-yellow-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
						<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/>
					</svg>
					其他获奖佐证材料
				</h2>

				<%
				ZsHjqk hjqk = new ZsHjqk();
				List jlist = new ArrayList();
				if (user!=null) {
					hjqk.setZsUser(user);
					jlist = jmanager.getDataByInstance(1,100,"hjId","asc",hjqk).getObjects();
				}
				for (int i=0; i<jlist.size(); i++){
					ZsHjqk obj = (ZsHjqk)jlist.get(i);
					String fname = obj.getHjName();
					file.setZsUser(user);
					file.setFiName(obj.getHjId()+"");
					file.setFiType("hjqk");
					flist = fmanager.findByExample(file);
				%>
				<div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
					<div class="flex flex-col md:flex-row md:items-center md:justify-between mb-4">
						<h3 class="text-lg font-semibold text-gray-900">
							<%=obj.getHjName() %> <span class="text-red-500">*</span>
						</h3>
						<%if(editpermit){%>
						<button id="a<%=i %>" onclick="upload('<%=obj.getHjId() %>','hjqk')" class="flex items-center px-3 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-yellow-500 focus:ring-offset-2 transition-colors duration-200">
							<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
								<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
							</svg>
							上传材料
						</button>
						<%} %>
					</div>

					<div class="overflow-x-auto">
						<table class="min-w-full bg-white border border-gray-200 rounded-lg">
							<thead class="bg-gray-50">
								<tr>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料名称</th>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">材料缩略图</th>
									<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
								</tr>
							</thead>
							<tbody class="divide-y divide-gray-200">
								<%
								if (flist.size()>0) {
									for (int k = 0; k < flist.size(); k++) {
										ZsFile fi = (ZsFile)flist.get(k);
										String fileName = fname+"材料"+(k+1);
										String url = fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false);
								%>
								<tr class="hover:bg-gray-50 transition-colors">
									<td class="px-4 py-3 text-sm text-gray-900">
										<a href='<%=url%>' target='_blank' class="text-blue-600 hover:text-blue-800 transition-colors">
											<%=fileName%> <%=fi.getAddTime()%>
										</a>
									</td>
									<td class="px-4 py-3">
										<a href='<%=url%>' target='_blank' class="inline-block">
											<img src='<%=url%>' alt='材料缩略图' class="h-12 w-auto rounded border border-gray-200">
										</a>
									</td>
									<td class="px-4 py-3 text-sm">
										<%if(editpermit){%>
										<button onclick="filedelete('<%=fi.getFiId()%>')" class="text-red-600 hover:text-red-800 transition-colors">
											删除
										</button>
										<%} %>
									</td>
								</tr>
								<%} } else { %>
								<tr>
									<td colspan="3" class="px-4 py-3 text-sm text-red-600 text-center">尚未上传</td>
								</tr>
								<%} %>
							</tbody>
						</table>
					</div>
				</div>
				<%}} %>
			</div>






    <form id="ff" name="add" role="form" class="form-horizontal" action="" method="post"  style="display:none;">
		<div id="container" style="width:96%;margin:0 auto;">
			<table id="zxtable" class="imgtable" style="width:100%;margin:0 auto;">
		    <thead>
		    <tr>
		    <th>材料名称</th>
		    <th>佐证材料</th>
		    </tr>
		    </thead>
		    <tbody>
		    <tr>
		    <td style="text-indent: 5px;"><input id="fiName" name="fiName" type="text" class="dfinput" value="" required style="display:none;"/></td>
		    <td style="text-indent: 5px;">
		    <a href='#' target='_blank'>材料</a>
		    </td>
		    </tr>
		    </tbody>
		    </table>
		    <input name="fiFile" type="text" id="fiFile" value=""  class="dfinput"  style="display:none;"/>
			<input id="fiId" name="fiId" type="text" class="dfinput" value="" style="display:none;"/>
		    <input id="zsUser.usId" name="zsUser.usId" type="text" class="dfinput" value="<%=user.getUsId()%>" style="display:none;"/>
		    <input id="fiType" name="fiType" type="text" class="dfinput" value="sbcl" style="display:none;"/>
			<div id="uploaderfile" class="wu-example">
			    <!--用来存放文件信息-->
			    佐证材料：
			    <div class="btns">
					<a id="postfiles" href="javascript:void(0);" class="btn btn-default" style="float:right;margin:10px;">确认保存</a>
				    <a id="selectfiles" href="javascript:void(0);" class="btn" style="float:right;margin:10px;">选择文件</a>
			    </div>
			</div>
			<script type="text/javascript" src="lib/crypto1/crypto/crypto.js"></script>
			<script type="text/javascript" src="lib/crypto1/hmac/hmac.js"></script>
			<script type="text/javascript" src="lib/crypto1/sha1/sha1.js"></script>
			<script type="text/javascript" src="lib/base64.js"></script>
			<script type="text/javascript" src="lib/plupload-2.1.2/js/plupload.full.min.js"></script>
			<script type="text/javascript" src="<%=request.getContextPath() %>/plugins/webupload/scripts/upload/ossfileupload.js"></script>
		</div>
 	</form>
        <div class="max-w-6xl mx-auto px-4 pb-8">
            <div class="bg-blue-50 border border-blue-200 rounded-lg p-6">
                <h3 class="text-lg font-semibold text-blue-900 mb-3 flex items-center">
                    <svg class="w-5 h-5 text-blue-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
                    </svg>
                    材料上传需知
                </h3>
                <div class="text-blue-800 text-sm leading-relaxed">
                    <%out.print(anconfig.getSingleConfigInfoByName("材料上传需知")); %>
                </div>
            </div>
        </div>
   </div>

<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript" charset="UTF-8"></script>
<script src="../plugins/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js" type="text/javascript"  charset="UTF-8"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var json;
	var zxlb="<%=zxstring%>";

		var updateOneAction = '../zsFileSave.action?randnum='+Math.floor(Math.random()*1000000);
		var loactionurl = 'zs_filesend.jsp';
		var fi_name = "";

		function checkSelections(fiId){
		$.ajax({
			    cache: false,
			    type: "POST",
			    url:"../zsFileCheck.action?fiId="+fiId,
			    dataType:"html",
			    async: false,
			    error: function(request) {
			    	alert("设置状态有误");
			    },
			    success: function(data) {///成功跳转
			    	alert("设置状态成功");
				    window.location = 'zs_filesend.jsp?usId=<%=user.getUsId()%>?'; ///当用ajax访问 时候成功的时候就自动的跳转过去
	            }
			});
		}
		$('.imgtable tbody tr:odd').addClass('odd');


	function filedelete(fiId){
	//alert(fiId);
	$.ajax({
		    cache: false,
		    type: "POST",
		    url:"../zsFileDelete.action?fiId="+fiId+"&key=<%=MD5.toMD5(user.getUsId().toString())%>",
		    dataType:"json",
		    async: false,
		    error: function(request) {
		    	alert("删除有误");
		    },
		    success: function(data) {///成功跳转
		    	alert("删除成功");
			    window.location = 'zs_filesend.jsp?usId=<%=user.getUsId()%>'; ///当用ajax访问 时候成功的时候就自动的跳转过去
            }
		});
	}

	function upload(fi_name, fi_type){
	//alert(fi_name);
	 $("#fiName").val(fi_name);
	 $("#fiType").val(fi_type);
	document.getElementById("selectfiles").click();
	}

	function send() {
		if(confirm("注意！！！请您仔细检查信息填写及材料上传是否准确完整。确认后，报名完成，您的信息及材料将不能再修改 ！！！您是否确认材料完整？")) {
			$.ajax({
		    	cache: false,
		    	type: "GET",
		        url:'../zsUserStatusAppPublic.action?usId=<%=user.getUsId()%>&key=<%=key%>&randnum='+Math.floor(Math.random()*1000000),
		        data:{},// 您的formid
		        async: false,
		        error: function(request) {
		        	alert("确认有误");
		        },
		        success: function(data) {
		        	console.info(data);
		        	if(data.flag=="error"){
		        		alert("无法确认，材料不完整。请在本页仔细检查所有材料是否上传。");
		        	} else {
		        		alert("确认成功！如后续发现材料有误，请在‘申请撤回’中撤回材料确认。");
		        		window.location = 'index.jsp';
		        	}
		        }
		    });
		}
	}

	function submitFileFormAdvance() {//带对象form提交
		var jsonString = JSON.stringify(serializeToJSON('#ff'));
		//alert(jsonString);
		ajaxSubmitFileForm(jsonString);
	}

	function ajaxSubmitFileForm(jsonString) {
		console.log(jsonString);
		$.ajax({
	    	cache: false,
	    	type: "POST",
	        url:'../zsFileSave.action?randnum='+Math.floor(Math.random()*1000000),
	        data:{rowstr:jsonString},// 你的formid
	        async: false,
	        error: function(request) {
	        	alert("保存有误");
	        },
	        success: function(data) {
	        	alert("保存成功");		            
	            if ("undefined" != typeof loactionurl) {
	            	window.location = loactionurl;
	            }
	        }
	    });
	}
		</script>
<script type="text/javascript">
var json;
var zxlb="<%=zxstring%>";
$(function(){
	$.get("../zsApplyView.action?usId=<%=user.getUsId()%>&randnum="+Math.floor(Math.random()*1000000), function(data) {
		json=data.rows;
		<%=school.getScSubJs() %>
	});
});

</script> 
<%} %>		
</body>

</html>
